Accessing attributes in a view

Hi everyone,

I've got a list of views (names of them as strings) in a module stored inside a skip list.

What I need to do is to find the attributes that are displayed in that view and save that into another skip list.

Is there any way to access the attributes that are displayed in a view? I essentially need the name of the attribute stored into a skip list.

Not sure how to do it but I've shown the general Idea in the code below:

 

Skip    skpAttrs;
string  viewName;
AttrDef ad;
for viewName in skpAllViews do {
 //In here go thorugh all the attributes in a view and save them to a skip list.
 for ad in <some view thing> do {
  put(skpAttrs, <some key here>, ad.name);
 }
}

 


Mr 4D - Fri Apr 06 07:01:37 EDT 2018

Re: Accessing attributes in a view
PekkaMakinen - Fri Apr 06 07:10:24 EDT 2018

The DXL Reference "Columns" section contains an example script which uses the attrName function, this will show what attribute is displayed in each column of the current view. Note the null result for main column or for Layout DXL column:

Column col 
for col in current Module do {
    string att = attrName(col) 
    if (null att) {
        if (main(col)) {
            print "main\t"
        } else {
            print dxl(col) "\t"
        }
    } else {
        print att "\t"
    }
} 

 

Re: Accessing attributes in a view
Mr 4D - Tue Apr 24 07:23:38 EDT 2018

PekkaMakinen - Fri Apr 06 07:10:24 EDT 2018

The DXL Reference "Columns" section contains an example script which uses the attrName function, this will show what attribute is displayed in each column of the current view. Note the null result for main column or for Layout DXL column:

Column col 
for col in current Module do {
    string att = attrName(col) 
    if (null att) {
        if (main(col)) {
            print "main\t"
        } else {
            print dxl(col) "\t"
        }
    } else {
        print att "\t"
    }
} 

 

Thanks @PekkaMakinen 2c62fe98-76da-481f-be77-55155704a095.

This approach works great for me.

If anyone else comes accross to use this should note that this won't work as expected if you have Layout DXL present in your view.

If you do, the attrName turns out to be the Layout DXL code itself.

This works very well for views without Layout DXL